<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" 
                                                  prefix="fn" %>
<%@ include file="/pages/common/taglibs.jsp"%>
<script type="text/javascript"
	src="${ctx}/pages/templete/js/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript">
  var ctx = '${ctx}';
  function jsApiCall()
	{
	  //console.log($("#timestamp").val());
	  //alert(document.getElementById("timestamp"));
		WeixinJSBridge.invoke(
			'getBrandWCPayRequest',{
				"appId" : $("#appId").val(), //公众号名称，由商户传入
				"timeStamp": $("#timestamp").val(), //时间戳，自1970 年以来的秒数
				"nonceStr" : $("#nonceStr").val(), //随机串
				"package" : $("#package").val(),
				"signType" : $("#signType").val(), //微信签名方式:
				"paySign" : $("#paySign").val()  //微信签名,
			},function(res){
				if(res.err_msg == "get_brand_wcpay_request:ok" ) {
					// 此处可以使用此方式判断前端返回,微信团队郑重提示：res.err_msg 将在用户支付成功后返回ok，但并不保证它绝对可靠，。
					alert("微信公众号支付成功!");
				}
				/* for(var i in res){
					alert(res[i]);
				} */
			}
		);
	}

</script>
<form id='payForm' name="payForm" action=""
	method="post" target="_blank" style="font-size: 200%" >
	<table width="100%" style="display:${!error?'block':'none'}">
		<tr>
			<td width="30%" align=right>公众号名称(appId):</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="appId" name="appId" value="${sc03.appId}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="appIdTip"></span>
			</td>
		</tr>
		<tr>
			<td width="30%" align=right>时间戳(timestamp):</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="timestamp" name="timestamp" value="${sc03.timeStamp}"
				size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="timestampTip"></span>
			</td>
		</tr>
		<tr>
			<td width="30%" align=right>随机串(nonceStr):</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="nonceStr" name="nonceStr" value="${sc03.nonceStr}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="nonceStrTip"></span>
			</td>
		</tr>
		<tr>
			<td width="30%" align=right>package:</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="package" name="package" value="${sc03.package1}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="packageTip"></span>
			</td>
		</tr>
		<tr>
			<td width="30%" align=right>签名类型(signType):</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="signType" name="signType" value="${sc03.signType}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left></td>
		</tr>
		<tr>
			<td width="30%" align=right>微信签名(paySign):</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="paySign" name="paySign" value="${sc03.paySign}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="paySignTip"></span>
			</td>
		</tr>
	<table width="100%" style="display:${!error?'block':'none'}">
		<tr>
			<td colspan=2>&nbsp;
				<td width="25%" align=left></td>
		</tr>
		<tr>
			<td colspan=2 width="100%"><center>
					<button type="button" onclick="jsApiCall()">微信支付</button>
				</center>
			</td>
		</tr>
	</table>
	</table>
	
	<table style="display:${error?'block':'none'}">
		<tr>
			<td width="30%" align=right>errCode:</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="respCode" name="respCode" value="${data.errCode}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="respCodeTip"></span>
			</td>
		</tr>
		<tr>
			<td width="30%" align=right>errMessage:</td>
			<td align=left width="45%">&nbsp;&nbsp;<input type="text"
				id="respMsg" name="respMsg" value="${data.errMessage}" size="50" readonly="readonly"/>
			</td>
			<td width="25%" align=left><font color=red>*</font><span
				id="respMsgTip"></span>
			</td>
		</tr>
	</table>
</form>

